/** @format */

import { resultsModel } from '../../../sdk'
import { CODE_TYPES } from '../../../errorCode'

export default async function checkRemainTimes(
  context: IContext<{ key: ITaskType }>,
  { userInfo }: IControllerInfos
) {
  const { key } = context.data
  const { remainTimes } = userInfo

  // 暂无领取次数
  if (!remainTimes?.[key]) return resultsModel.error(CODE_TYPES.ERROR_TASK_NORECEIVE)
}
